import 'package:flutter/material.dart';
import 'package:shenling_logistics/pages/task/completeTask.dart';
import 'package:shenling_logistics/pages/task/pendingPickUpTask.dart';
import 'package:shenling_logistics/pages/task/wayTask.dart';

class TaskPage extends StatefulWidget {
  const TaskPage({super.key});

  @override
  State<TaskPage> createState() => _TaskPageState();
}

class _TaskPageState extends State<TaskPage> {
  // 定义任务tabBar数据
  List taskTabBarList = [
    {'title': '待提货'},
    {'title': '在途'},
    {'title': '已完成'},
  ];

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DefaultTabController(
        length: 3,
        child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: taskTabBarList.map((item) {
                return Tab(text: item['title']);
              }).toList(),
              indicatorColor: Colors.red, //  修改下划线颜色为红色
              indicatorWeight: 3,
              indicatorPadding: EdgeInsetsGeometry.only(bottom: 8),
              labelColor: Colors.black,
              labelStyle: TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
              unselectedLabelColor: Color.fromARGB(255, 129, 129, 129),
              unselectedLabelStyle: TextStyle(
                fontSize: 16,
                fontWeight: FontWeight.w600,
              ),
            ),
            backgroundColor: Colors.white,
            toolbarHeight: 0,
          ),
          body: TabBarView(
            children: [PendingTaskPage(), WayTaskPage(), CompleteTaskPage()],
          ),
        ),
      ),
    );
  }
}
